#include <bits/stdc++.h>
using namespace std;
int cun, lmm = 0, tmm;
int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);

	for (int i = 1; i <= 12; i++) {
		int m = 300 + lmm;
		cin >> tmm;
		int ans = m - tmm;
		if (ans < 0) {
			cout<<-i;
			return 0;
		} else {
			cun += ans/100*100;
			lmm = ans%100;
		}
	}
	cout<<cun*1.2+lmm;
	return 0;

}
